<template>
  <div>
    <el-dropdown>
      <svg-icon name="language" size="25"></svg-icon>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item :disabled="flag" @click="handleLanguage('zh-CN')">简体中文</el-dropdown-item>
          <el-dropdown-item :disabled="!flag" @click="handleLanguage('en-US')">English</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script setup lang="ts">
import {useLayouts} from "@/stores/modules/layouts.ts";

const layouts = useLayouts()
const { header } = storeToRefs(layouts)

const flag = computed(() => {
  return header.value.language === "zh-CN"
})

// 语言切换
const handleLanguage = (language: string) => {
  // TODO:根据参数判断切换那种语言
  header.value.language = language
}
</script>

<style scoped lang="scss">

</style>